﻿<%@ Page Language="C#" MasterPageFile="~/cms/cms.master" AutoEventWireup="true" CodeFile="introduction.aspx.cs" Inherits="cms_products" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div class="main-title">Cập nhật bài giới thiệu:</div>
    <div class="main-content">
        <asp:DetailsView ID="dvItem" runat="server" 
            AutoGenerateEditButton="True" AutoGenerateRows="False" 
            DataKeyNames="id" DataSourceID="sdsItem"
            Width="100%" GridLines="None">
            <CommandRowStyle CssClass="detailviewButton" />
            <RowStyle CssClass="detailviewRow" />
            <FieldHeaderStyle CssClass="detailviewHeader" />
            <Fields>
                <asp:TemplateField HeaderText="Tiêu đề:">
                    <EditItemTemplate>
                        <asp:TextBox ID="txtTitle" runat="server" Text='<%# Bind("title") %>' 
                            Width="90%"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rvTen" runat="server" ErrorMessage="(*)"
                         ControlToValidate="txtTitle"></asp:RequiredFieldValidator>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="txtTitle" runat="server" Text='<%# Bind("title") %>' 
                            Width="90%"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rvTitle" runat="server" ErrorMessage="(*)"
                         ControlToValidate="txtTitle"></asp:RequiredFieldValidator>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <b><%# Eval("title")%></b>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Title:">
                    <EditItemTemplate>
                        <asp:TextBox ID="txtTitleE" runat="server" Text='<%# Bind("enTitle") %>' 
                            Width="90%"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rvTitleE" runat="server" ErrorMessage="(*)"
                         ControlToValidate="txtTitleE"></asp:RequiredFieldValidator>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="txtTitleE" runat="server" Text='<%# Bind("enTitle") %>' 
                            Width="90%"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rvTitleE" runat="server" ErrorMessage="(*)"
                         ControlToValidate="txtTitleE"></asp:RequiredFieldValidator>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <b><%# Eval("enTitle")%></b>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Chi tiết:">
                    <EditItemTemplate>
                        <telerik:RadEditor ID="reDetails" runat="server" Height="300px" 
                         Skin="Office2007" ToolsFile="radeditor.xml" Width="100%"
                         Content='<%# Bind("details") %>'>
                            <ImageManager UploadPaths="~\upload\news"
                             DeletePaths="~\upload\news" ViewPaths="~\upload\news" />
                        </telerik:RadEditor>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <telerik:RadEditor ID="reDetails" runat="server" Height="300px" 
                         Skin="Office2007" ToolsFile="radeditor.xml" Width="100%"
                         Content='<%# Bind("details") %>'>
                            <ImageManager UploadPaths="~\upload\news"
                             DeletePaths="~\upload\news" ViewPaths="~\upload\news" />
                        </telerik:RadEditor>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <%# Eval("details")%>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Details:">
                    <EditItemTemplate>
                        <telerik:RadEditor ID="reEnDetails" runat="server" Height="300px" 
                         Skin="Office2007" ToolsFile="radeditor.xml" Width="100%"
                         Content='<%# Bind("enDetails") %>'>
                            <ImageManager UploadPaths="~\upload\news"
                             DeletePaths="~\upload\news" ViewPaths="~\upload\news" />
                        </telerik:RadEditor>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <telerik:RadEditor ID="reEnDetails" runat="server" Height="300px" 
                         Skin="Office2007" ToolsFile="radeditor.xml" Width="100%"
                         Content='<%# Bind("enDetails") %>'>
                            <ImageManager UploadPaths="~\upload\news"
                             DeletePaths="~\upload\news" ViewPaths="~\upload\news" />
                        </telerik:RadEditor>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <%# Eval("enDetails")%>
                    </ItemTemplate>
                </asp:TemplateField>
            </Fields>
        </asp:DetailsView>
        <asp:SqlDataSource ID="sdsItem" runat="server" 
            ConnectionString="<%$ ConnectionStrings:hotb %>" 
            SelectCommand="_introductionGetItemForCMS" SelectCommandType="StoredProcedure" 
            UpdateCommand="_introductionUpdate" UpdateCommandType="StoredProcedure">
            <SelectParameters>
                <asp:QueryStringParameter DefaultValue="0" Name="id" 
                    QueryStringField="id" Type="Int32" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter Name="id" Type="Int32" />
                <asp:Parameter Name="title" Type="String" />
                <asp:Parameter Name="enTitle" Type="String" />
                <asp:Parameter Name="details" Type="String" />
                <asp:Parameter Name="enDetails" Type="String" />
            </UpdateParameters>
        </asp:SqlDataSource>
    </div>
</asp:Content>

